
const $api = require('./request/index').API;
App({
  onLaunch() {
    console.log('App Launch')
    //调用API从本地缓存中获取数据
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    $api.getToken().then(res => {
      wx.setStorageSync('token', res.token)
    }) 
  },
  onShow() {
    console.log('App Show')
  },
  onHide() {
    console.log('App Hide')
  },
})